# coding=utf-8
import os

path = "C:\\Users\\visual\\Desktop\\mac-ip-time.csv"
file = open(path, 'r')
# (1,'com.smit.pay',1,30,'112233445566','127.0.0.1','2017-04-12 14:30:36'),
count = 1
sql_str = ''
for line in file:
    line.replace('\r', '')
    items = line.replace("\n", "").split(",")
    new_line = "(%d,\'com.smit.pay\',1,30,\'%s\',\'%s\',\'%s\')," % (count, items[0], items[1], items[2][0:19])
    sql_str += new_line
    count += 1
    print(new_line)

file.close()
file = open("C:\\Users\\visual\\Desktop\\sql.sql", 'w+')
file.write(sql_str)
file.close()
